<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" />
<meta name="mobileOptimized" content="240" />
<meta name="format-detection" content="telephone=no" />
<title>Insert title here</title>
</head>
<body>
<span>1</span>
<div id="k"></div>
<script type="text/javascript">
	var spans = document.getElementsByTagName("span");
	for(var i=0,n=spans.length;i<n;i++){
		alert(i);
		k.innerHTML="<div><span>fdsfsd</span>fdsfds<span>fdsfdsfds</span></div>";
		console.log(i);
	}
</script>
</body>
</html>